{include file='public/header'}
<style>
	.hhkk{
		background: url("__PUBLIC__/home/images/v10_a19.png");
		background-size: 100% 100%;
		padding: 10px;
	}
</style>
<body class="">
<div class="bg_fixed_v10_1"></div>
	<div class="sectionY sectionY_tttt">
		<a href="{:url('Set/popularize')}">
			<img src="__PUBLIC__/home/images/v10_a9.png" alt="" class="a1">
		</a>
		<p class="p1">
			<span class="ppp_title">资产出售</span>
		</p>
	</div>
	<div class="kong1"></div>
	<div class="ecx_section1">
		<div class="container">
			<p class="p2">提醒：</p>
			<p class="p1">您当前有:{$userinfo.pushs}, 每日只允许出售资产15次。</p>
		</div>
	</div>
	<div class="ecx_section2">
			<div class="t1">
				<div class="hhkk">
					<div class="f1 clearfix" >
						<span class="s1" style="position: relative;top:-5px;">资产类型：</span>
						<div class="aty">
							<select name="" id="">
								<option value="">推广收益({$userinfo.pushs})</option>
							</select>
						</div>
						<img src="__PUBLIC__/home/images/a23_1.png" alt="">
					</div>
					<div class="f1 clearfix">
						<span class="s1">出售数量：</span>
						<input type="number" name='salary' placeholder="请填写资产数量">
					</div>
					<div class="f1 clearfix" style="border-bottom: none">
						<span class="s1">交易密码：</span>
						<input type="password" name='pwd' placeholder="请输入交易密码">
					</div>
				</div>
				<div class="sub">
					<input type="submit" value="确认出售">
					<p class="p1">提示：请先通过实名认证再进行资产出售</p>
				</div>
			</div>
	</div>
</body>

</html>




<script>
	$(function(){
        $('input[type=submit]').click(function(){
            var num = $('input[name=salary]').val();
            var pwd = $('input[name=pwd]').val();
            if(num=='' || num<{:config('setting.recommendprice')}){
                layer.alert('请检查您要出售的资产数量，资产出售不能低于低于{:config("setting.recommendprice")}！',{icon: 2,shade:0.8,title:"错误提示:"});return false;
            }
            if(pwd==''){
                layer.alert('请输入交易密码！',{icon: 2,shade:0.8,title:"错误提示:"});return false;
            }
            $.ajax({
    			type: 'POST',
    			url: "{:url('Set/sale_create_order')}",
    			dataType: "html",
    			data: "num="+num+"&pwd="+pwd,
    			success:function(responsestr){
                    var str = isJSON(responsestr);
    				if(str==1){
                        var obj=JSON.parse(responsestr);
                        if(obj.s==10){
                            layer.msg(obj.msg,{shade:0.6,time:1000,end:function(){
                                window.location.href=window.location.href;
                            }});
                        }else{
                            layer.alert(obj.msg,{shade:0.2});return false;
                        }
    				}else{
    					layer.alert('系统错误，请联系管理员',{icon: 2,shade:0.8,title:"错误提示:"});
    				}
    			},
    			error:function(){
    				layer.alert('系统繁忙，请稍后再试！',{icon: 2,shade:0.8,title:"错误提示:"});
    			}
    		});
        });
	})

	function isJSON(str) {
		if (typeof str == 'string') {
			try{
				var obj=JSON.parse(str);
				if(str.indexOf('{')>-1){
					return 1;
				}else{
					return 0;
				}
			}catch(e){
				return 0;
			}
		}
		return 0;
	}
</script>
